package com.ereach;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.Queue;

public class MainQueue {
    public static void main(String[] args) {
        Queue<String> queue = new LinkedList<>();

        queue.add("Jan");
        queue.add("Feb");
        queue.add("Mar");
        queue.add("Apr");
        queue.add("May");
        queue.add("Jun");
        queue.add("Jul");
        queue.add("Aug");
        queue.add("Sep");
        queue.add("Oct");
        queue.add("Nov");
        queue.add("Dec");

        System.out.println(queue);

        System.out.println("===check the queue if it is empty");
        System.out.println(queue.isEmpty());

        System.out.println("===get the queue size");
        System.out.println(queue.size());

        System.out.println("===check the queue if it contains Aug");
        System.out.println(queue.contains("Aug"));

        System.out.println("===forEach lambda expression");
        queue.forEach(x -> System.out.println(x));

        System.out.println("===for each loop");
        for (var x : queue)
            System.out.println(x);

        System.out.println("===Iterator");
        Iterator<String> it = queue.iterator();
        while (it.hasNext()) {
            String n = it.next();
            System.out.println(n);
        }

        System.out.println("===remove");
        queue.remove();
        System.out.println(queue);

        System.out.println("===");
        queue.remove("Aug");
        System.out.println(queue);

    }
}
